package com.hs.core.utils;

import java.util.List;
import java.util.Map;

import com.hs.core.db.DBMgr;

public class DictUtil {
	public String selectDict(String type,String checkcode){
		String sql = "select * from HS_CODE where YOUXBJ=1 and DICTTYPE='"+type+"'   order by dictcode asc";
		List list = DBMgr.getDbUtilInst().queryList(sql, null);
		StringBuffer sb = new StringBuffer();
		sb.append("<option value>");
		sb.append("请选择");
		sb.append("</option>");
		sb.append("\n");
		for (int i = 0; i < list.size(); i++) {
			Map code = (Map)list.get(i);
			String diccode = (String)code.get("DICTCODE");
			sb.append("<option value=");
			sb.append(diccode);
			if(diccode.equals(checkcode)){
				sb.append(" selected ");
			}
			sb.append(">");
			sb.append(code.get("DICTNAME"));
			sb.append("</option>");
			sb.append("\n");
		}
		return sb.toString();
	}
	
	public static void main(String[] args) {
		
	}
}
